<?php

namespace  App\Http\Controllers\V1;

use App\Helpers\Logger\SLogger;
use App\Helpers\RestResponseFactory;
use App\Helpers\RestUtils;
use App\Http\Controllers\Controller;
use App\Models\Factory\ProductFactory;
use App\Models\Factory\SmsFactory;
use App\Models\Factory\UserFactory;
use App\Models\Orm\Banner;
use App\Models\Orm\Version;
use App\Services\Core\Sms\Dahan\DahanService;
use Illuminate\Http\Request;
/**
 * Class GeetesController
 * @package App\Http\Controllers\V1
 * 短信
 */
class VersionController extends  Controller
{

    /**
     *获取产品列表
     * @param Request $request
     * @return \Illuminate\Http\JsonResponse
     */
    public function getVersion(Request $request)
    {
        $info = $request->all();
        $app_name = array_search($info['app_name'],config('xianjindai.app_name'));
        $channel = array_search($info['channel'],config('xianjindai.channel'));

        $data = Version::where('app_name',$app_name)->where('channel',$channel)->where('version_code',$info['version_code'])->first();
        if($data)
        {
            $result['status'] = $data->status;
            return RestResponseFactory::ok($result, 200);

        }
        $result['status'] = 0;
        return RestResponseFactory::ok($result, 200);

    }
}